package game.leon.seawar.server.service;

import game.leon.seawar.meta.Battle;
import org.springframework.stereotype.Component;

import java.util.HashMap;
import java.util.Map;

/**
 * User: BianP
 * Date: 12-1-2
 */
@Component
public class BattleService {
    private Map<Long, Battle> battleMap = new HashMap<Long, Battle>();
    //
    // 创建一个新的battle
    //
    public Battle createBattle(long striker, long counter) {
        Battle battle = new Battle(striker, counter);
        battleMap.put(striker, battle);
        return battle;
    }
    public void removeBattle(long striker) {
        battleMap.remove(striker);
    }
    //
    // 根据striker, 获得一个battle
    //
    public Battle getBattle(long striker) {
        return battleMap.get(striker);
    }

}
